<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html:html locale="true">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title></title>
<link href="console.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
.even {
	background:	#eee;
}

.odd {

}
</style>
</head>

<body>
<jsp:include page="/title.jsp" flush="true"/>

	<p class="lnkhead2"><bean:message key='menu.engines'/>&gt;<bean:write name="domain" />&gt;<bean:message key='menu.processes'/>&gt;<bean:message key='menu.processesFinished'/></p>
	<form name="form" method="post" action="case.do">
	<input type="hidden" name="act" value="listCaseHistory"/>
	<input type="hidden" name="domain" value="<bean:write name='domain'/>"/>
		<input type="hidden" name="pageup" value="<bean:write name='pageup'/>"/>			
			<input type="hidden" name="begin"  value="0"/>		
			<input type="hidden" name="length" value="15"/>
			<input type="hidden" name="pagedown" value="<bean:write name='pagedown'/>"/>
	<table width="95%" border="0" cellpadding="0"  cellspacing="0">
		<tr  class="txtnormal2">
		<td><bean:message key="process.name"/>
		<input type="text" name="processName" value="<bean:write name='processName'/>"  size="16"/>
		</td>
		<td><bean:message key="heading.state"/>
				<html:select  name="stateInfo" size="1" property="state" > 
        <option value="0"><bean:message key='case.stateAll'/></option>
        <option value="4"><bean:message key='case.stateFinished'/></option>
        <option value="3"><bean:message key='case.stateCanceled'/></option>
                </html:select>
		</td>
		<td><bean:message key="case.startUser"/>
		<input type="text" name="startUser" value="<bean:write name='startUser'/>"  size="8"/></td>
		
		<td><bean:message key='case.finishDate'/>
		<input type="text" id="start" name="startDateAfter" value="<bean:write name='startDateAfter'/>"   size="10"/>
		<a href="javascript:void(0)" 

onclick="if(self.gfPop)gfPop.fPopCalendar(start);return false;" 

HIDEFOCUS><img name="popcal" align="absmiddle" src="calendar/calbtn.gif" 

width="34" height="22" border="0" alt=""></a>
		<%--		<input type="text" id="end" name="startDateBefor" value="<bean:write name='startDateBefor'/>"  readonly="true" size="10"/>
				<a href="javascript:void(0)" 

onclick="if(self.gfPop)gfPop.fPopCalendar(end);return false;" 

HIDEFOCUS><img name="popcal" align="absmiddle" src="calendar/calbtn.gif" 

width="34" height="22" border="0" alt=""></a> --%>
				</td>
		<td><input  type="button" name="query_button" value="<bean:message key='button.query'/>" onclick="javascript:query()">
	</td>
		</tr>
		</table>
	<table width="98%" border="0" cellpadding="1" class="sort-table" id="table-1" cellspacing="0">
	
	<thead>
			
			<tr >
				<td align="center" width="8%">				
  					<bean:message key="case.id"/>
				</td>
				<td align="center" width="15%">
				<bean:message key="process.name"/>	
				
				</td>
				<td align="center" width="20%">
					<bean:message key="case.processIndex"/>
				
					
				</td>
				
				<td align="center" width="10%">
					
					<bean:message key="case.startUser"/>
					
				</td>
				<td align="center" width="10%">
					
				<bean:message key="case.startDate"/>
				</td>
				
				<td align="center" width="8%">
					
					<bean:message key="heading.state"/>
				</td>
				
				<td align="center" width="12%">
					<bean:message key='case.finishDate'/>
				</td>
				
			</tr>
	  </thead>
			<tbody>
			<% int i=0; String color;String check="";%>
			
			<logic:iterate id="caserun" name="caselist">
				<% i++; if(i%2==1) color="odd"; else color="even"; if(i==1) check="checked"; else check="";%>
				
				<tr  class="<%=color%>">
					<td align="left">
					<input type="radio"  name="id"  value="<bean:write name="caserun" property="caseId"/>" 
					onclick="javascript:todoSelected(<bean:write name='caserun' property='state'/>)" />
					<a href='case.do?act=queryCaseLog&domain=<bean:write name="domain"/>&caseId=<bean:write name="caserun" property="caseId"/>'><bean:write name="caserun" property="caseId"/>	</a>		
					<logic:equal value="true" name="caserun" property="isSubCase">*</logic:equal>
					</td>
					<td align="left">
						
						<bean:write name="caserun" property="processName" filter="true"/>
						
					</td>
					<td align="left">
						
						<bean:write name="caserun" property="processIndex" filter="true"/>
						
					</td>
					
				<td align="center">
						
						<bean:write name="caserun" property="startUser"/>
						
					</td>
					
					<td align="center">
						
						<bean:write format="MM-dd HH:mm" name="caserun" property="startDate" filter="true"/>
						
					</td>
					
					<td align="center">
						
						<bean:write  name="caserun" property="stateName"/>
						
					</td>
					
					<td align="center">
						
						<bean:write format="MM-dd HH:mm" name="caserun" property="finishDate"/>
						
					</td>
				</tr>
			
			</logic:iterate>
	  </tbody>
</table>
	<table width="95%">		
			<tr >
				<td align="left">
				<input  type="button" name="restart_button" value="<bean:message key="button.reStartCase"/>" onclick="javascript:restart()" disabled = "true">
				</td>
				<td>
				<div id="restart_form"  style="visibility:hidden; z-index:2" >
					<table width="100%" border="0" cellpadding="0"  cellspacing="0">	
						<tr  class="txtnormal2">			
							<td algin="right"><bean:message key="case.reStartNode"/>
								<input type="text" size="18" name="nodeId"  />
								<input type="button" name="restartConfirm_button" value="<bean:message key="button.ok"/>" onclick="javascript:restartConfirm()" >
							</td>
						</tr>
					</table>
				</div>	
				</td>
				<td align="right">
					
					<logic:greaterEqual name="pageup" value="0">
						
						<a  class="lnksub1" href="javascript:pageup()">
							
							<bean:message key="button.pageup"/>
							
						</a>
						
					</logic:greaterEqual>
					
					<logic:notEqual name="pagedown" value="0">
						
						<a  class="lnksub1" href="javascript:pagedown()">
							
							<bean:message key="button.pagedown"/>
							
						</a>
						
					</logic:notEqual></td>
				
			</tr>
			</table>
			
</form>			
		
			<script type="text/javascript">
var st = new SortableTable(document.getElementById("table-1"),
	["None","String", "String","String",  "String", "String","String"]);
	</script>
	<script type="text/javascript">
	function todoSelected(state){
		var frm = document.forms["form"];
		frm.elements["restart_button"].disabled = false;
		}
	function restartConfirm(){
	var frm = document.forms["form"];
	var id=(selectedRadiobox(frm,"id"));
	if( !confirm("<bean:message key="case.confirmRestart"/>("+id+") ?")) return;
	frm.elements["act"].value="reStartCase";
	frm.submit();
	};
	
	function restart()
	{
	var frm = document.forms["form"];
	var id=(selectedRadiobox(frm,"typeIndex"));
	if(id==null) return;
	shift_visibility(restart_form);
	};
	function shift_visibility(image1){
 		if(image1.style.visibility == "visible")
  			image1.style.visibility = "visible";
  		else  image1.style.visibility = "visible";
	}	
	function pagedown()
	{
	var frm = document.forms["form"];
	frm.elements["begin"].value=frm.elements["pagedown"].value;
	frm.submit();
	}
	function pageup()
	{
	var frm = document.forms["form"];
	frm.elements["begin"].value=frm.elements["pageup"].value;
	frm.submit();	
	}
	function query()
	{
	var frm = document.forms["form"];
	frm.elements["begin"].value = 0;
	frm.submit();	
	}
	
</script>
<!--  PopCalendar(tag name and id must match) Tags should sit at the page bottom -->
<iframe width=174 height=189 name="gToday:normal:agenda.js" 

id="gToday:normal:agenda.js" src="calendar/ipopeng.htm" 

scrolling="no" frameborder="0" style="visibility:visible; z-index:999; 

position:absolute; left:-500px; top:0px;">
</iframe>
<%@ include file="/table_bottom.jsp" %>
<logic:notEmpty name="returnMsg">
	<script>
	alert('<bean:write name="returnMsg"/>');
	</script>
	</logic:notEmpty>
</body>
</html:html>





